package com.fit.pages.car;

import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;


import com.fit.interfaces.Car;
import com.fit.service.Cars;

public class ViewCar {

	@Inject
	@Property
	private Cars cars;
	
	@Property
	private Car currentCar;
	
	@InjectPage
	private CarDetails carDetailsPage;
	
	@OnEvent(component = "carDetailsLink")
	Object onShowDetails(String modelName) {
		Car chosenCar = cars.retriveSingleCar(modelName);
		carDetailsPage.setChosenCar(chosenCar);
		return carDetailsPage;
	}
}
